\hypertarget{dispatcher_8c}{
\section{dispatcher.c File Reference}
\label{dispatcher_8c}\index{dispatcher.c@{dispatcher.c}}
}
Functions for dispatching a message to the correct function.  


{\tt \#include \char`\"{}dispatcher.h\char`\"{}}\par
{\tt \#include \char`\"{}robot.h\char`\"{}}\par
{\tt \#include $<$stdint.h$>$}\par
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{structmethod}{method}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{dispatcher_8c_e55dbdf443ce70f44dae537b4c1969ff}{init\_\-dispatcher} (void)
\item 
void \hyperlink{dispatcher_8c_8cde8adafa0c103a1a0e5d0290631738}{register\_\-action} (uint8\_\-t device\_\-type, uint8\_\-t function\_\-id, void($\ast$function)(uint8\_\-t id, uint8\_\-t $\ast$data, uint8\_\-t length))
\item 
void \hyperlink{dispatcher_8c_4702d5590338297f30cf7058471bba60}{dispatch} (uint8\_\-t $\ast$cmd, uint8\_\-t $\ast$data, uint8\_\-t length)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
uint8\_\-t \hyperlink{dispatcher_8c_9a926a38eb4d54ff404b50f4b51ab72a}{device\_\-index} = 0
\item 
struct \hyperlink{structmethod}{method} \hyperlink{dispatcher_8c_c2af50a9fcf0ab242ce5f0c3c2f142a1}{device\_\-functions} \mbox{[}MAX\_\-DEVICE\_\-FUNCTIONS\mbox{]}
\end{CompactItemize}


\subsection{Detailed Description}
Functions for dispatching a message to the correct function. 

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}


\subsection{Function Documentation}
\hypertarget{dispatcher_8c_4702d5590338297f30cf7058471bba60}{
\index{dispatcher.c@{dispatcher.c}!dispatch@{dispatch}}
\index{dispatch@{dispatch}!dispatcher.c@{dispatcher.c}}
\subsubsection[{dispatch}]{\setlength{\rightskip}{0pt plus 5cm}void dispatch (uint8\_\-t $\ast$ {\em cmd}, \/  uint8\_\-t $\ast$ {\em data}, \/  uint8\_\-t {\em length})}}
\label{dispatcher_8c_4702d5590338297f30cf7058471bba60}


Dispatches a message which is received by the robot.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cmd}]an array of lenth 3 containing the device type, device id, and function id. \item[{\em data}]the data to be passed to the function. \item[{\em length}]the length of the data being passed to the function. \end{description}
\end{Desc}
\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}
\hypertarget{dispatcher_8c_e55dbdf443ce70f44dae537b4c1969ff}{
\index{dispatcher.c@{dispatcher.c}!init\_\-dispatcher@{init\_\-dispatcher}}
\index{init\_\-dispatcher@{init\_\-dispatcher}!dispatcher.c@{dispatcher.c}}
\subsubsection[{init\_\-dispatcher}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-dispatcher (void)}}
\label{dispatcher_8c_e55dbdf443ce70f44dae537b4c1969ff}


Initializes the dispatcher by wiping the device function array and setting the index to 0.

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}
\hypertarget{dispatcher_8c_8cde8adafa0c103a1a0e5d0290631738}{
\index{dispatcher.c@{dispatcher.c}!register\_\-action@{register\_\-action}}
\index{register\_\-action@{register\_\-action}!dispatcher.c@{dispatcher.c}}
\subsubsection[{register\_\-action}]{\setlength{\rightskip}{0pt plus 5cm}void register\_\-action (uint8\_\-t {\em device\_\-type}, \/  uint8\_\-t {\em function\_\-id}, \/  void($\ast$)(uint8\_\-t id, uint8\_\-t $\ast$data, uint8\_\-t length) {\em function})}}
\label{dispatcher_8c_8cde8adafa0c103a1a0e5d0290631738}


Registers a given action for a device type and function ID.

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}


\subsection{Variable Documentation}
\hypertarget{dispatcher_8c_c2af50a9fcf0ab242ce5f0c3c2f142a1}{
\index{dispatcher.c@{dispatcher.c}!device\_\-functions@{device\_\-functions}}
\index{device\_\-functions@{device\_\-functions}!dispatcher.c@{dispatcher.c}}
\subsubsection[{device\_\-functions}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf method}  {\bf device\_\-functions}\mbox{[}MAX\_\-DEVICE\_\-FUNCTIONS\mbox{]}}}
\label{dispatcher_8c_c2af50a9fcf0ab242ce5f0c3c2f142a1}


An array of device function used to locate and run the correct function upon message receival. \hypertarget{dispatcher_8c_9a926a38eb4d54ff404b50f4b51ab72a}{
\index{dispatcher.c@{dispatcher.c}!device\_\-index@{device\_\-index}}
\index{device\_\-index@{device\_\-index}!dispatcher.c@{dispatcher.c}}
\subsubsection[{device\_\-index}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t {\bf device\_\-index} = 0}}
\label{dispatcher_8c_9a926a38eb4d54ff404b50f4b51ab72a}


The index of the device 